const mongoose = require('mongoose')

const schema = new mongoose.Schema({
  categories: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Category' }], // 分类
  title: { type: String }, // 标题
  body: { type: String } // 详情
}, {
  // 自动加入时间戳，两个字段 createAt,updateAt
  timestamps: true
})

module.exports = mongoose.model('Article', schema)